#define DEBUG
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

const int maxn=100000;
const long long maxx=1000000000, sgtsize=6LL*maxx;

long long min(long long a, long long b) {
  return a<b ? a : b;
}

long long max(long long a, long long b) {
  return a>b ? a : b;
}

class Point {
public:
  long long x, y;

  static bool cmp(Point x, Point y) {
    return x.x<y.x;
  }
};

class SegmentTree {
public:
  SegmentTree *left, *right;
  int v;

  SegmentTree() {
    left=right=NULL;
    v=0;
  }

  void add(long long t, long long l, long long r) {
    if (l==r) {
      v++;
    } else {
      long long mid=(l+r)/2;
      if (t<=mid) {
	if (!left) {
	  left = new SegmentTree();
	}
	left->add(t, l, mid);
      } else {
	if (!right) {
	  right = new SegmentTree();
	}
	right->add(t, mid+1, r);
      }
      v = 0;
      if (left) {
	v = v+left->v;
      }
      if (right) {
	v = v+right->v;
      }
    }
  }

  int get(long long tl, long long tr, long long l, long long r) {
    if (l==tl && r==tr) {
      return v;
    } else {
      long long mid=(l+r)/2, ret=0;
      if (tl<=mid && tr>=l && left) {
	ret += left->get(max(tl, l), min(tr, mid), l, mid);
      }
      if (tl<=r && tr>mid && right) {
	ret += right->get(max(tl, mid+1), min(tr, r), mid+1, r);
      }
      return ret;
    }
  }
};

void calcCover(int o, int n, int m, int d, Point man[][maxn+1], long long cover[]) {
  SegmentTree *sgt = new SegmentTree();
  int i=1, j=1, k=1;
  for (; i<=m;) {
    long long t=man[!o][i].x;
    for (; j<=n && man[o][j].x-d-1<t; j++) {
      cover[j]-=sgt->get(man[o][j].y-d, man[o][j].y+d, 1, sgtsize);
    }
    for (; k<=n && man[o][k].x+d<t; k++) {
      cover[k]+=sgt->get(man[o][k].y-d, man[o][k].y+d, 1, sgtsize);
    }
    for (; i<=m && man[!o][i].x<=t; i++) {
      sgt->add(man[!o][i].y, 1, sgtsize);
    }
  }
  for (; j<=n; j++) {
    cover[j]-=sgt->get(man[o][j].y-d, man[o][j].y+d, 1, sgtsize);
  }
  for (; k<=n; k++) {
    cover[k]+=sgt->get(man[o][k].y-d, man[o][k].y+d, 1, sgtsize);
  }
}

int main() {
  freopen("mhw.in", "r", stdin);
  freopen("mhw.out", "w", stdout);

  static Point man[2][maxn+1];
  int n, m, d;
  scanf("%d %d %d", &n, &m, &d);
  for (int i=1; i<=n; i++) {
    long long x, y;
    scanf("%lld %lld", &x, &y);
    man[0][i].x = x+y+2*maxx;
    man[0][i].y = x-y+2*maxx;
  }
  for (int i=1; i<=m; i++) {
    long long x, y;
    scanf("%lld %lld", &x, &y);
    man[1][i].x = x+y+2*maxx;
    man[1][i].y = x-y+2*maxx;
  }

  sort(man[0]+1, man[0]+n+1, Point::cmp);
  sort(man[1]+1, man[1]+m+1, Point::cmp);

  static long long cover[2][maxn+1];
  calcCover(0, n, m, d, man, cover[0]);
  calcCover(1, m, n, d, man, cover[1]);

  sort(cover[0]+1, cover[0]+n+1);
  sort(cover[1]+1, cover[1]+m+1);

  long long maxans=0, minans=0;
  for (int i=1; i<=n; i++) {
    long long t=cover[0][i]*(cover[0][i]-1)/2;
    maxans = maxans+cover[0][i]*(i-1)-t;
    minans = minans+cover[0][i]*(n-i)-t;
  }
  for (int i=1; i<=m; i++) {
    long long t=cover[1][i]*(cover[1][i]-1)/2;
    maxans = maxans+cover[1][i]*(i-1)-t;
    minans = minans+cover[1][i]*(m-i)-t;
  }
  printf("%lld %lld", minans, maxans);

  fclose(stdin);
  fclose(stdout);
  return 0;
}
